import { getItem, setItem } from '@/utils/storage'
import { MAIN_COLOR, DEFAULT_COLOR } from '@/constant'
import variables from '@/assets/style/variables.scss'
export default {
  namespaced: true,
  state () {
    return {
      variables: {
        ...variables,
        menuBg: getItem(MAIN_COLOR) || DEFAULT_COLOR
      },
      mainColor: getItem(MAIN_COLOR) || DEFAULT_COLOR
    }
  },
  mutations: {
    setMainColor (state, color) {
      state.mainColor = color
      state.variables.menuBg = color
      setItem(MAIN_COLOR, color)
    }
  }
}
